IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'InvoiceItemCreate')
	BEGIN
		DROP  Procedure  InvoiceItemCreate
	END

GO

CREATE Procedure InvoiceItemCreate
(
	@invoiceId int,
	@details nvarchar(200),
	@quantity float,
	@unitTypeFlag int,
	@rate money,
	@invoiceItemId int OUTPUT
)
AS

INSERT INTO InvoiceItems
	(InvoiceId, Details, Quantity, UnitTypeFlag, Rate)
VALUES
	(@invoiceId, @details, @quantity, @unitTypeFlag, @rate)
	
SET @invoiceItemId = SCOPE_IDENTITY()

GO